package com.boang.set;

import java.util.Objects;

/*
    @author:sa
    @date:2024/11/29 11:18
*/
public class Student implements Comparable<Student>{
    public String name;
    public int age;
    public Student(String name,int age){
        this.name=name;
        this.age=age;
    }

    @Override
    public int compareTo(Student o) {
        return this.age-o.age;
    }
//
//    @Override
//    public boolean equals(Object o) {
//        if (this == o) return true;
//        if (o == null || getClass() != o.getClass()) return false;
//        Student student = (Student) o;
//        return age == student.age && Objects.equals(name, student.name);
//    }
//
//    @Override
//    public int hashCode() {
//        return Objects.hash(name, age);
//    }
//
    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}